home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / misc / mf-db.zip / VBSAMPLE\BCARDS.FRM < prev    next >
Text File  |  1993-11-17  |  42KB  |  1,289 lines

  1. VERSION 2.00
  2. Begin Form bcard 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Business Cards"
  5.    ClientHeight    =   4755
  6.    ClientLeft      =   915
  7.    ClientTop       =   1680
  8.    ClientWidth     =   5475
  9.    Height          =   5415
  10.    Left            =   870
  11.    LinkTopic       =   "Form3"
  12.    ScaleHeight     =   4755
  13.    ScaleWidth      =   5475
  14.    Top             =   1065
  15.    Width           =   5565
  16.    Begin Frame gBox 
  17.       BackColor       =   &H00C0C0C0&
  18.       Enabled         =   0   'False
  19.       Height          =   4695
  20.       Left            =   60
  21.       TabIndex        =   0
  22.       Top             =   0
  23.       Width           =   5355
  24.       Begin ComboBox Combo1 
  25.          FontBold        =   0   'False
  26.          FontItalic      =   0   'False
  27.          FontName        =   "MS Sans Serif"
  28.          FontSize        =   8.25
  29.          FontStrikethru  =   0   'False
  30.          FontUnderline   =   0   'False
  31.          Height          =   300
  32.          Left            =   3180
  33.          Style           =   2  'Dropdown List
  34.          TabIndex        =   10
  35.          Top             =   2940
  36.          Width           =   1995
  37.       End
  38.       Begin TextBox Text1 
  39.          Height          =   285
  40.          Index           =   0
  41.          Left            =   180
  42.          TabIndex        =   1
  43.          Top             =   780
  44.          Width           =   2115
  45.       End
  46.       Begin TextBox Text1 
  47.          Height          =   285
  48.          Index           =   1
  49.          Left            =   2340
  50.          TabIndex        =   2
  51.          Top             =   780
  52.          Width           =   2835
  53.       End
  54.       Begin TextBox Text1 
  55.          Height          =   285
  56.          Index           =   2
  57.          Left            =   180
  58.          TabIndex        =   4
  59.          Top             =   1860
  60.          Width           =   4995
  61.       End
  62.       Begin TextBox Text1 
  63.          Height          =   285
  64.          Index           =   3
  65.          Left            =   180
  66.          TabIndex        =   5
  67.          Top             =   2400
  68.          Width           =   2595
  69.       End
  70.       Begin TextBox Text1 
  71.          Height          =   285
  72.          Index           =   4
  73.          Left            =   2880
  74.          TabIndex        =   6
  75.          Top             =   2400
  76.          Width           =   435
  77.       End
  78.       Begin TextBox Text1 
  79.          Height          =   285
  80.          Index           =   5
  81.          Left            =   3660
  82.          TabIndex        =   7
  83.          Top             =   2400
  84.          Width           =   1515
  85.       End
  86.       Begin TextBox Text1 
  87.          Height          =   285
  88.          Index           =   6
  89.          Left            =   180
  90.          TabIndex        =   3
  91.          Top             =   1320
  92.          Width           =   4995
  93.       End
  94.       Begin CommandButton Command1 
  95.          Caption         =   "&Next Card"
  96.          FontBold        =   0   'False
  97.          FontItalic      =   0   'False
  98.          FontName        =   "MS Sans Serif"
  99.          FontSize        =   8.25
  100.          FontStrikethru  =   0   'False
  101.          FontUnderline   =   0   'False
  102.          Height          =   375
  103.          Index           =   0
  104.          Left            =   120
  105.          TabIndex        =   13
  106.          Top             =   4140
  107.          Width           =   1695
  108.       End
  109.       Begin CommandButton Command1 
  110.          Caption         =   "&Previous Card"
  111.          FontBold        =   0   'False
  112.          FontItalic      =   0   'False
  113.          FontName        =   "MS Sans Serif"
  114.          FontSize        =   8.25
  115.          FontStrikethru  =   0   'False
  116.          FontUnderline   =   0   'False
  117.          Height          =   375
  118.          Index           =   1
  119.          Left            =   120
  120.          TabIndex        =   12
  121.          Top             =   3780
  122.          Width           =   1695
  123.       End
  124.       Begin CommandButton Command2 
  125.          Caption         =   "&Find Card"
  126.          FontBold        =   0   'False
  127.          FontItalic      =   0   'False
  128.          FontName        =   "MS Sans Serif"
  129.          FontSize        =   8.25
  130.          FontStrikethru  =   0   'False
  131.          FontUnderline   =   0   'False
  132.          Height          =   375
  133.          Left            =   120
  134.          TabIndex        =   11
  135.          Top             =   3420
  136.          Width           =   3315
  137.       End
  138.       Begin CommandButton Command3 
  139.          Caption         =   "New &Card"
  140.          FontBold        =   0   'False
  141.          FontItalic      =   0   'False
  142.          FontName        =   "MS Sans Serif"
  143.          FontSize        =   8.25
  144.          FontStrikethru  =   0   'False
  145.          FontUnderline   =   0   'False
  146.          Height          =   375
  147.          Left            =   1800
  148.          TabIndex        =   14
  149.          Top             =   3780
  150.          Width           =   1635
  151.       End
  152.       Begin Frame Frame1 
  153.          BackColor       =   &H00C0C0C0&
  154.          Caption         =   "Order by"
  155.          FontBold        =   0   'False
  156.          FontItalic      =   0   'False
  157.          FontName        =   "MS Sans Serif"
  158.          FontSize        =   8.25
  159.          FontStrikethru  =   0   'False
  160.          FontUnderline   =   0   'False
  161.          Height          =   1155
  162.          Left            =   3660
  163.          TabIndex        =   19
  164.          Top             =   3360
  165.          Width           =   1515
  166.          Begin OptionButton Option1 
  167.             BackColor       =   &H00C0C0C0&
  168.             Caption         =   "Reference"
  169.             FontBold        =   0   'False
  170.             FontItalic      =   0   'False
  171.             FontName        =   "MS Sans Serif"
  172.             FontSize        =   8.25
  173.             FontStrikethru  =   0   'False
  174.             FontUnderline   =   0   'False
  175.             Height          =   255
  176.             Index           =   2
  177.             Left            =   180
  178.             TabIndex        =   18
  179.             Top             =   780
  180.             Width           =   1215
  181.          End
  182.          Begin OptionButton Option1 
  183.             BackColor       =   &H00C0C0C0&
  184.             Caption         =   "Person"
  185.             FontBold        =   0   'False
  186.             FontItalic      =   0   'False
  187.             FontName        =   "MS Sans Serif"
  188.             FontSize        =   8.25
  189.             FontStrikethru  =   0   'False
  190.             FontUnderline   =   0   'False
  191.             Height          =   255
  192.             Index           =   0
  193.             Left            =   180
  194.             TabIndex        =   16
  195.             Top             =   300
  196.             Value           =   -1  'True
  197.             Width           =   1095
  198.          End
  199.          Begin OptionButton Option1 
  200.             BackColor       =   &H00C0C0C0&
  201.             Caption         =   "Company"
  202.             FontBold        =   0   'False
  203.             FontItalic      =   0   'False
  204.             FontName        =   "MS Sans Serif"
  205.             FontSize        =   8.25
  206.             FontStrikethru  =   0   'False
  207.             FontUnderline   =   0   'False
  208.             Height          =   255
  209.             Index           =   1
  210.             Left            =   180
  211.             TabIndex        =   17
  212.             Top             =   540
  213.             Width           =   1155
  214.          End
  215.       End
  216.       Begin TextBox Text1 
  217.          Height          =   285
  218.          Index           =   7
  219.          Left            =   180
  220.          TabIndex        =   8
  221.          Top             =   2940
  222.          Width           =   1455
  223.       End
  224.       Begin TextBox Text1 
  225.          Height          =   285
  226.          Index           =   8
  227.          Left            =   1680
  228.          TabIndex        =   9
  229.          Top             =   2940
  230.          Width           =   1455
  231.       End
  232.       Begin CommandButton Command4 
  233.          Caption         =   "&Save Card"
  234.          FontBold        =   0   'False
  235.          FontItalic      =   0   'False
  236.          FontName        =   "MS Sans Serif"
  237.          FontSize        =   8.25
  238.          FontStrikethru  =   0   'False
  239.          FontUnderline   =   0   'False
  240.          Height          =   375
  241.          Left            =   1800
  242.          TabIndex        =   15
  243.          Top             =   4140
  244.          Width           =   1635
  245.       End
  246.       Begin Label LiveNum 
  247.          BackColor       =   &H00C0C0C0&
  248.          Caption         =   "Live Records:"
  249.          FontBold        =   0   'False
  250.          FontItalic      =   0   'False
  251.          FontName        =   "MS Sans Serif"
  252.          FontSize        =   8.25
  253.          FontStrikethru  =   0   'False
  254.          FontUnderline   =   0   'False
  255.          Height          =   195
  256.          Left            =   2580
  257.          TabIndex        =   31
  258.          Top             =   240
  259.          Width           =   2175
  260.       End
  261.       Begin Label Label1 
  262.          BackColor       =   &H00C0C0C0&
  263.          Caption         =   "Reference"
  264.          FontBold        =   0   'False
  265.          FontItalic      =   0   'False
  266.          FontName        =   "MS Sans Serif"
  267.          FontSize        =   8.25
  268.          FontStrikethru  =   0   'False
  269.          FontUnderline   =   0   'False
  270.          ForeColor       =   &H00FF0000&
  271.          Height          =   255
  272.          Index           =   9
  273.          Left            =   3180
  274.          TabIndex        =   30
  275.          Top             =   2700
  276.          Width           =   915
  277.       End
  278.       Begin Label Label1 
  279.          BackColor       =   &H00C0C0C0&
  280.          Caption         =   "First Name"
  281.          FontBold        =   0   'False
  282.          FontItalic      =   0   'False
  283.          FontName        =   "MS Sans Serif"
  284.          FontSize        =   8.25
  285.          FontStrikethru  =   0   'False
  286.          FontUnderline   =   0   'False
  287.          ForeColor       =   &H00FF0000&
  288.          Height          =   195
  289.          Index           =   0
  290.          Left            =   180
  291.          TabIndex        =   29
  292.          Top             =   540
  293.          Width           =   915
  294.       End
  295.       Begin Label Label1 
  296.          BackColor       =   &H00C0C0C0&
  297.          Caption         =   "Last Name"
  298.          FontBold        =   0   'False
  299.          FontItalic      =   0   'False
  300.          FontName        =   "MS Sans Serif"
  301.          FontSize        =   8.25
  302.          FontStrikethru  =   0   'False
  303.          FontUnderline   =   0   'False
  304.          ForeColor       =   &H00FF0000&
  305.          Height          =   195
  306.          Index           =   1
  307.          Left            =   2340
  308.          TabIndex        =   28
  309.          Top             =   540
  310.          Width           =   915
  311.       End
  312.       Begin Label Label1 
  313.          BackColor       =   &H00C0C0C0&
  314.          Caption         =   "Address"
  315.          FontBold        =   0   'False
  316.          FontItalic      =   0   'False
  317.          FontName        =   "MS Sans Serif"
  318.          FontSize        =   8.25
  319.          FontStrikethru  =   0   'False
  320.          FontUnderline   =   0   'False
  321.          ForeColor       =   &H00FF0000&
  322.          Height          =   255
  323.          Index           =   2
  324.          Left            =   180
  325.          TabIndex        =   27
  326.          Top             =   1620
  327.          Width           =   915
  328.       End
  329.       Begin Label Label1 
  330.          BackColor       =   &H00C0C0C0&
  331.          Caption         =   "City"
  332.          FontBold        =   0   'False
  333.          FontItalic      =   0   'False
  334.          FontName        =   "MS Sans Serif"
  335.          FontSize        =   8.25
  336.          FontStrikethru  =   0   'False
  337.          FontUnderline   =   0   'False
  338.          ForeColor       =   &H00FF0000&
  339.          Height          =   255
  340.          Index           =   3
  341.          Left            =   180
  342.          TabIndex        =   26
  343.          Top             =   2160
  344.          Width           =   915
  345.       End
  346.       Begin Label Label1 
  347.          BackColor       =   &H00C0C0C0&
  348.          Caption         =   "State"
  349.          FontBold        =   0   'False
  350.          FontItalic      =   0   'False
  351.          FontName        =   "MS Sans Serif"
  352.          FontSize        =   8.25
  353.          FontStrikethru  =   0   'False
  354.          FontUnderline   =   0   'False
  355.          ForeColor       =   &H00FF0000&
  356.          Height          =   255
  357.          Index           =   4
  358.          Left            =   2880
  359.          TabIndex        =   25
  360.          Top             =   2160
  361.          Width           =   495
  362.       End
  363.       Begin Label Label1 
  364.          BackColor       =   &H00C0C0C0&
  365.          Caption         =   "Zip Code"
  366.          FontBold        =   0   'False
  367.          FontItalic      =   0   'False
  368.          FontName        =   "MS Sans Serif"
  369.          FontSize        =   8.25
  370.          FontStrikethru  =   0   'False
  371.          FontUnderline   =   0   'False
  372.          ForeColor       =   &H00FF0000&
  373.          Height          =   255
  374.          Index           =   5
  375.          Left            =   3660
  376.          TabIndex        =   24
  377.          Top             =   2160
  378.          Width           =   915
  379.       End
  380.       Begin Label Label1 
  381.          BackColor       =   &H00C0C0C0&
  382.          Caption         =   "Company"
  383.          FontBold        =   0   'False
  384.          FontItalic      =   0   'False
  385.          FontName        =   "MS Sans Serif"
  386.          FontSize        =   8.25
  387.          FontStrikethru  =   0   'False
  388.          FontUnderline   =   0   'False
  389.          ForeColor       =   &H00FF0000&
  390.          Height          =   195
  391.          Index           =   6
  392.          Left            =   180
  393.          TabIndex        =   23
  394.          Top             =   1080
  395.          Width           =   915
  396.       End
  397.       Begin Label Label1 
  398.          BackColor       =   &H00C0C0C0&
  399.          Caption         =   "Voice"
  400.          FontBold        =   0   'False
  401.          FontItalic      =   0   'False
  402.          FontName        =   "MS Sans Serif"
  403.          FontSize        =   8.25
  404.          FontStrikethru  =   0   'False
  405.          FontUnderline   =   0   'False
  406.          ForeColor       =   &H00FF0000&
  407.          Height          =   255
  408.          Index           =   7
  409.          Left            =   180
  410.          TabIndex        =   22
  411.          Top             =   2700
  412.          Width           =   915
  413.       End
  414.       Begin Label Label1 
  415.          BackColor       =   &H00C0C0C0&
  416.          Caption         =   "Fax"
  417.          FontBold        =   0   'False
  418.          FontItalic      =   0   'False
  419.          FontName        =   "MS Sans Serif"
  420.          FontSize        =   8.25
  421.          FontStrikethru  =   0   'False
  422.          FontUnderline   =   0   'False
  423.          ForeColor       =   &H00FF0000&
  424.          Height          =   255
  425.          Index           =   8
  426.          Left            =   1680
  427.          TabIndex        =   21
  428.          Top             =   2700
  429.          Width           =   915
  430.       End
  431.       Begin Label CardNum 
  432.          BackColor       =   &H00C0C0C0&
  433.          Caption         =   "Card: 0/0"
  434.          FontBold        =   0   'False
  435.          FontItalic      =   0   'False
  436.          FontName        =   "MS Sans Serif"
  437.          FontSize        =   8.25
  438.          FontStrikethru  =   0   'False
  439.          FontUnderline   =   0   'False
  440.          Height          =   195
  441.          Left            =   180
  442.          TabIndex        =   20
  443.          Top             =   240
  444.          Width           =   2175
  445.       End
  446.    End
  447.    Begin Menu m_File 
  448.       Caption         =   "&File"
  449.       Begin Menu m_InitDB 
  450.          Caption         =   "&Create Card Databases..."
  451.       End
  452.       Begin Menu m_Sep1 
  453.          Caption         =   "-"
  454.       End
  455.       Begin Menu m_Open 
  456.          Caption         =   "&Open Cards..."
  457.       End
  458.       Begin Menu m_Close 
  459.          Caption         =   "&Close Cards"
  460.       End
  461.       Begin Menu m_Sep2 
  462.          Caption         =   "-"
  463.       End
  464.       Begin Menu m_Quit 
  465.          Caption         =   "&Quit"
  466.       End
  467.    End
  468.    Begin Menu mOther 
  469.       Caption         =   "&Other"
  470.       Begin Menu mLockRecord 
  471.          Caption         =   "&Lock this record"
  472.          Shortcut        =   ^L
  473.       End
  474.       Begin Menu mSep1 
  475.          Caption         =   "-"
  476.       End
  477.       Begin Menu mDelete 
  478.          Caption         =   "&Delete current record"
  479.          Shortcut        =   ^D
  480.       End
  481.       Begin Menu mSepOther 
  482.          Caption         =   "-"
  483.       End
  484.       Begin Menu mReIndex 
  485.          Caption         =   "&ReIndex database"
  486.       End
  487.       Begin Menu mEditRefTbl 
  488.          Caption         =   "&Edit Reference Table"
  489.       End
  490.       Begin Menu mSepOther2 
  491.          Caption         =   "-"
  492.       End
  493.       Begin Menu mSevere 
  494.          Caption         =   "&SP Demo"
  495.          Begin Menu mSevereLoad 
  496.             Caption         =   "Load list using SP API"
  497.          End
  498.          Begin Menu mNormalLoad 
  499.             Caption         =   "Load list using standard 'skips'"
  500.          End
  501.          Begin Menu SPSep 
  502.             Caption         =   "-"
  503.          End
  504.          Begin Menu mSPCount 
  505.             Caption         =   "Get COUNT- SP"
  506.          End
  507.       End
  508.       Begin Menu mSep1121 
  509.          Caption         =   "-"
  510.       End
  511.       Begin Menu mBottom 
  512.          Caption         =   "&Bottom of index"
  513.       End
  514.       Begin Menu mTop 
  515.          Caption         =   "&Top of index"
  516.       End
  517.    End
  518.    Begin Menu m_Test 
  519.       Caption         =   "&Test"
  520.       Begin Menu m_AddXRnd 
  521.          Caption         =   "&Add X - Random..."
  522.       End
  523.       Begin Menu m_RplXRandom 
  524.          Caption         =   "&Replace X - Random..."
  525.       End
  526.    End
  527.    Begin Menu mHelp 
  528.       Caption         =   "&Help"
  529.       Begin Menu mAbout 
  530.          Caption         =   "&About..."
  531.       End
  532.    End
  533. End
  534. Option Explicit
  535.  
  536. ' Change this to a location better for you...
  537. Const CARDFILE = "C:\source\bcard"
  538.  
  539. Dim PersonDBHndl As Integer ' Handle to person db
  540. Dim PersonCurIndex As Integer ' Current index selected
  541. Dim PersonCurRec As Long      ' Record currently in use...
  542. Dim PersonTotRecs As Long   ' total # of recs in person db
  543.  
  544.  
  545.  
  546. Dim curFile As String   ' Curretly open DB file name
  547.  
  548. ' Take data from disply and store in tCard
  549. Function bcFillData% (c As tCard)
  550.     c.Person.fname = text1(0).Text
  551.     c.Person.lname = text1(1).Text
  552.     c.data.street = text1(2).Text
  553.     c.data.city = text1(3).Text
  554.     c.data.state = text1(4).Text
  555.     c.data.zip = text1(5).Text
  556.  
  557.     c.company.cName = text1(6).Text
  558.  
  559.     
  560.     c.ref.ref = Combo1.ListIndex
  561.     
  562.  
  563.  
  564.     c.data.voice = text1(7).Text
  565.     c.data.fax = text1(8).Text
  566.  
  567.  
  568.  
  569. End Function
  570.  
  571. ' take data from var and display it
  572. Function bcShowData% (c As tCard)
  573.     text1(0).Text = c.Person.fname
  574.     text1(1).Text = c.Person.lname
  575.     text1(2).Text = c.data.street
  576.     text1(3).Text = c.data.city
  577.     text1(4).Text = c.data.state
  578.     text1(5).Text = c.data.zip
  579.  
  580.     text1(6).Text = c.company.cName
  581.     ' since the 'random add' functions don't
  582.     ' set this value properly -- we have to check
  583.     ' for an error condition...
  584.     On Error Resume Next
  585.     Combo1.ListIndex = c.ref.ref
  586.     On Error GoTo 0
  587.  
  588.     text1(7).Text = c.data.voice
  589.     text1(8).Text = c.data.fax
  590.     'Command4.Enabled = False
  591.     'command3.Enabled = False
  592.  
  593.     ' Updates statistics at  the top of the screen...
  594.     UpdateStats
  595.  
  596.  
  597.  
  598. End Function
  599.  
  600. Sub Command1_Click (Index As Integer)
  601.     Dim PlusMinus As Integer
  602.     Dim NextRec As Long
  603.     Dim bcard As tCard
  604.  
  605.     ' Are They going FORWARD or BACKWARD
  606.     If Index = 0 Then
  607.         PlusMinus = 1   ' Next Record
  608.     ElseIf Index = 1 Then
  609.         PlusMinus = -1
  610.     Else
  611.         PlusMinus = 0   ' just force a re-display
  612.     End If
  613.     If PersonCurRec > 0 Then
  614.  
  615.         PersonCurRec = mfSkip(PersonCurRec, PlusMinus, TaskHndl, PersonDBHndl, PersonCurIndex)
  616.         If PersonCurRec = MFSEEK_BOF Then
  617.             Beep
  618.             ' They tried to skip past the begining of the file.  Since we already
  619.             ' overwrote the ptr to the previous record, we need to find out
  620.             ' what the first record was...
  621.             PersonCurRec = mfTop(TaskHndl, PersonDBHndl, PersonCurIndex)
  622.         ElseIf PersonCurRec = MFSEEK_EOF Then
  623.             Beep
  624.             ' They tried to skip past the END of the file.  Since we already
  625.             ' overwrote the ptr to the previous record, we need to find out
  626.             ' what the first record was...
  627.             PersonCurRec = mfBottom(TaskHndl, PersonDBHndl, PersonCurIndex)
  628.         End If
  629.         junk = mfRead(PersonCurRec, bcard, TaskHndl, PersonDBHndl, MFRW_ALL)
  630.     Else
  631.         ' We end up here if it's an empty database
  632.         PersonCurRec = 0
  633.     End If
  634.  
  635.     If junk < 0 Then
  636.         ' This shouldn't happen...
  637.         MsgBox "Bad Read"
  638.     End If
  639.     cardnum.Caption = curFile + " " + Format$(PersonCurRec) + " of " + Format$(PersonTotRecs) + " cards"
  640.     junk = bcShowData(bcard)
  641.  
  642. End Sub
  643.  
  644. ' Find a record
  645. Sub Command2_Click ()
  646.     Dim jump$, code%, jumpto&, s$, jumpint%
  647.  
  648.     ' Which Index do they have active? (Order by box)
  649.     If PersonCurIndex = 0 Then
  650.         s = "Seek String for Last/First name"
  651.     ElseIf PersonCurIndex = 1 Then
  652.         s = "Seek String for Company"
  653.     Else
  654.         s = "Seek String for Reference #"
  655.     End If
  656.     jump = InputBox$(s, "Record")
  657.  
  658.     ' NOTE: ALL seeks are SOFT.  If you need an
  659.     ' exact match, then assume if you fully specify
  660.     ' a key, it will be an exact...
  661.     If PersonCurIndex = 2 Then  ' search for a int...
  662.         ' INTS/LONGS/<Specialized> data types are passed with the
  663.         ' MFSEEKO structure.  Since STRINGS (mfseeks) don't pass well
  664.         ' using the as ANY keyword, there is a special mfseeks.  This
  665.         ' is only a problem in VB.  Any language that supports passing
  666.         ' ptrs to data will work fine with mf.
  667.         jumpint = Val(jump)
  668.         PersonCurRec = mfSeekO(jumpint, code, TaskHndl, PersonDBHndl, PersonCurIndex)
  669.     Else
  670.          ' SHOULD be padded to the length of the key
  671.          ' else, it will probably not seek correctly
  672.          ' (NOTE: Any padding you use for character keys
  673.          ' should be consistent so you won't have to have
  674.          ' alot of routines to do the seeking...
  675.          ' (NOTE: MF doesn't care if you OVERPAD something.  However, if you
  676.          ' UNDERPAD something -- you could get a GPF.  This is just the nature of
  677.          ' the C language )
  678.         jump = jump + Pad(128, " ")
  679.         PersonCurRec = mfSeekS(jump, code, TaskHndl, PersonDBHndl, PersonCurIndex)
  680.     End If
  681.  
  682.     If PersonCurRec = MFSEEK_EOF Then
  683.         MsgBox ("Search key was greater than any key in the database")
  684.     Else
  685.         If code = MFSEEK_EXACT_MATCH Then
  686.             MsgBox ("Exact Match")
  687.         Else ' code will equal 2...
  688.             MsgBox ("Closest Match")
  689.         End If
  690.     End If
  691.  
  692.  
  693.     ' will update display with current record
  694.     Command1_Click -1
  695.  
  696. End Sub
  697.  
  698. Sub Command3_Click ()
  699. ' Add a new record
  700.     Dim bcard As tCard
  701.  
  702.     junk = bcFillData(bcard)
  703.    
  704.     ' First, append a new record to the database.
  705.     ' NOTE: ON APPENDS:
  706.     ' PASS >>ONLY<< the DATA portion of the record.  Do NOT pass the
  707.     ' key along with the record.
  708.     PersonCurRec = mfAppendData(bcard.data, TaskHndl, PersonDBHndl)
  709.     ' Now, we have a reference to the new record.  We should proably
  710.     ' verify that it is a good # (not negative).
  711.     If PersonCurRec > 0 Then
  712.     
  713.         ' The MFRW_ALL flag tells it to update ALL index fields.  If we want
  714.         ' to enhance the SPEED and we know we have blank fields, then we
  715.         ' could have specified a specific index to update...
  716.         junki = mfWrite(PersonCurRec, bcard, TaskHndl, PersonDBHndl, MFRW_ALL)
  717.         If junki < 0 Then
  718.             MsgBox "Error on write:" + Format$(junki)
  719.         End If
  720.              
  721.         ' This will tell us how many records are now in the database
  722.         ' The size of a record, and the number of index's
  723.         Dim vRecSize%, vNumIndex%, vNumRecs&, vLiveRecs&
  724.         junk = mfInfoDB(vRecSize, vNumIndex, vNumRecs, vLiveRecs, TaskHndl, PersonDBHndl)
  725.         
  726.         PersonTotRecs = vNumRecs
  727.     
  728.     Else
  729.         If junkl < 0 Then
  730.             MsgBox "Error on add: " + Format$(junkl)
  731.         End If
  732.     End If
  733.  
  734.     cardnum.Caption = CARDFILE + " " + Format$(PersonCurRec) + "/" + Format$(PersonTotRecs)
  735.     LiveNum.Caption = "Live Records:" + Format$(vLiveRecs)
  736.  
  737. End Sub
  738.  
  739. Sub Command4_Click ()
  740. ' Re-write current record...
  741.     Dim bcard As tCard
  742.     If PersonCurRec > 0 Then
  743.         ' General function to get TEXT fields into a structure
  744.         junk = bcFillData(bcard)
  745.         
  746.         junkl = mfWrite(PersonCurRec, bcard, TaskHndl, PersonDBHndl, MFRW_ALL)
  747.     
  748.         If junkl < 0 Then
  749.             MsgBox "Error on write:" + Format$(junkl)
  750.         End If
  751.     Else
  752.         MsgBox "Not a valid record to SAVE to"
  753.     End If
  754.  
  755.  
  756. End Sub
  757.  
  758. Sub Command5_Click ()
  759.     ' To see the 'size' (# of bytes in the key) of a particular index, just add a button (called command5) and
  760.     ' this will show you the 'size' of the active index...
  761.     MsgBox "Index Size:" + Format$(mfInfoIndex(TaskHndl, PersonDBHndl, PersonCurIndex))
  762.  
  763. End Sub
  764.  
  765. Sub Form_Load ()
  766.     mfBeginRun
  767.  
  768.     PersonDBHndl = -1
  769.  
  770. End Sub
  771.  
  772. Sub Form_Unload (Cancel As Integer)
  773.     ' Will auto-close any open db's
  774.     mfEndRun
  775.     
  776.  
  777. End Sub
  778.  
  779. ' Place some sample data in the Reference database
  780. Sub LoadSampleData (file$)
  781.     Dim ref As tReference
  782.  
  783.     refDBHndl = mfOpen(file, TaskHndl)
  784.     ref.ref = 1
  785.     ref.refsub = 0
  786.     ref.name = "Stores"
  787.     junk = mfWrite(mfAppendData(ref.name, TaskHndl, refDBHndl), ref, TaskHndl, refDBHndl, MFRW_ALL)
  788.  
  789.     ref.ref = 1
  790.     ref.refsub = 1
  791.     ref.name = "Pizza"
  792.     junk = mfWrite(mfAppendData(ref.name, TaskHndl, refDBHndl), ref, TaskHndl, refDBHndl, MFRW_ALL)
  793.  
  794.     ref.ref = 1
  795.     ref.refsub = 2
  796.     ref.name = "Computer"
  797.     junk = mfWrite(mfAppendData(ref.name, TaskHndl, refDBHndl), ref, TaskHndl, refDBHndl, MFRW_ALL)
  798.  
  799.     ref.ref = 1
  800.     ref.refsub = 3
  801.     ref.name = "Movies"
  802.     junk = mfWrite(mfAppendData(ref.name, TaskHndl, refDBHndl), ref, TaskHndl, refDBHndl, MFRW_ALL)
  803.     
  804.     ref.ref = 2
  805.     ref.refsub = 0
  806.     ref.name = "Personal"
  807.     junk = mfWrite(mfAppendData(ref.name, TaskHndl, refDBHndl), ref, TaskHndl, refDBHndl, MFRW_ALL)
  808.  
  809.     ref.ref = 2
  810.     ref.refsub = 1
  811.     ref.name = "Relatives"
  812.     junk = mfWrite(mfAppendData(ref.name, TaskHndl, refDBHndl), ref, TaskHndl, refDBHndl, MFRW_ALL)
  813.  
  814.     ref.ref = 2
  815.     ref.refsub = 2
  816.     ref.name = "Friends"
  817.     junk = mfWrite(mfAppendData(ref.name, TaskHndl, refDBHndl), ref, TaskHndl, refDBHndl, MFRW_ALL)
  818.      
  819.     junk = mfClose(refDBHndl, TaskHndl)
  820.  
  821. End Sub
  822.  
  823. Sub m_AddXRnd_Click ()
  824. ' Tests Adding X # of random cards to the database.
  825. ' This is mostly for data-verifaction/system stress test
  826. ' (Since we know the first thing you'll want to do is
  827. ' see if you can crash it, we left this in here...<g>)
  828. ' If you are going to compare the 'speed' of MF with
  829. ' this function, feel free.  We would like to offer
  830. ' the results, though, right now:
  831. '
  832. ' We tested: 3 index's (2 characer, 1 integer... of same
  833. '                       size)
  834. ' Clipper: (DOS)
  835. '       Recs/Second: 5 with LOCK, UNLOCK, FLUSHing
  836. ' (however, we were totally amazed that taking out the 'flush' brought around 150 records/second)
  837. ' unfortunately, the records weren't 'REAL' records and it wasn't a REAL network... oh well)
  838. '
  839. ' vxBase: Recs/Second: 15 with LOCK, UNLOCK, WRITE
  840. '
  841. ' mf:   Generally, 20-30...
  842.  
  843.     If PersonDBHndl = -1 Then
  844.         MsgBox "Open a database before trying this..."
  845.         Exit Sub
  846.     End If
  847.     Dim jump&, n&
  848.     Dim c As tCard
  849.  
  850.     jump = Val(InputBox$("# of records to add?", "Add"))
  851.  
  852.     c.data.street = "<Test Data>"
  853.     c.data.city = "<Test Data>"
  854.     c.data.state = "<>"
  855.     c.data.zip = "<Test>"
  856.     c.data.voice = "<Test>"
  857.     c.data.fax = "<Test>"
  858.     Randomize
  859.  
  860.     screen.MousePointer = 11    ' Hourglass
  861.  
  862.     For n = 1 To jump
  863.  
  864.         c.Person.fname = Format$(Rnd)
  865.         c.Person.lname = Format$(Rnd)
  866.         c.company.cName = Format$(Rnd)
  867.         c.ref.ref = Rnd * 32000
  868.  
  869.         PersonTotRecs = mfAppendData(c.data, TaskHndl, PersonDBHndl)
  870.         
  871.         ' NOTE: To see the 'effect' of INDEXING overhead (described in the
  872.         ' Docs), comment out this line...and step back...<grin>
  873.         junkl = mfWrite(PersonTotRecs, c, TaskHndl, PersonDBHndl, MFRW_ALL)
  874.  
  875.         If junkl < 0 Then
  876.             MsgBox "Error on add:" + Format$(junkl)
  877.         End If
  878.         If Int(n / 10) = n / 10 Then
  879.             cardnum.Caption = "Processed: " + Format$(n)
  880.             cardnum.Refresh
  881.         End If
  882.         ' This creates, in effect, background processing...
  883.         junk = DoEvents()
  884.  
  885.     Next n
  886.  
  887.     screen.MousePointer = 0    ' Default
  888.     'PersonCurRec = PersonTotRecs
  889.     cardnum.Caption = CARDFILE + " " + Format$(PersonCurRec) + "/" + Format$(PersonTotRecs)
  890.  
  891.  
  892. End Sub
  893.  
  894. ' Closing database...
  895. Sub m_Close_Click ()
  896.     m_Open.Enabled = True
  897.     m_Close.Enabled = False
  898.     gBox.Enabled = False
  899.  
  900.     junk = mfClose(TaskHndl, PersonDBHndl)
  901.     junk = mfClose(TaskHndl, refDBHndl)
  902.     PersonDBHndl = -1
  903.  
  904.  
  905. End Sub
  906.  
  907. ' This demostrates creating a database
  908. Sub m_InitDB_Click ()
  909.     Dim file$, recsize%
  910.     Dim Person As tPerson
  911.     Dim company As tCompany
  912.     Dim ref As tref
  913.     Dim bcard As tCard
  914.     
  915.     If PersonDBHndl <> -1 Then
  916.         MsgBox "Close all databases before doing this..."
  917.         Exit Sub
  918.     End If
  919.  
  920.  
  921.     file = InputBox$("Enter File Name (7 character max -- no extension)", "Create CardFile", CARDFILE)
  922.     If Len(file) > 0 Then
  923.         screen.MousePointer = PHOURGLASS
  924.     
  925.         ' CREATE CARD DATABASE
  926.  
  927.         ' Calculate the size of an individual records 'data'
  928.         recsize = Len(bcard) - Len(Person) - Len(company) - Len(ref)
  929.     
  930.         ' Fill arrays with index parameters
  931.         ' Note: we have 3 index's for this database
  932.         ReDim indSize(0 To 2) As tintArray
  933.         ReDim indType(0 To 2) As tintArray
  934.         indSize(0).i = Len(Person)  ' Key 0 (index 0...)
  935.         indSize(1).i = Len(company) ' Key 1
  936.         indSize(2).i = Len(ref)     ' Key 2
  937.     
  938.             ' This tells mf the TYPE of the index
  939.         indType(0).i = MFCOMP_CHARIC  ' CHAR key - case insensitive
  940.         indType(1).i = 1001           ' UDK (user-defined key) - Sorts in 'reverse' order...
  941.                                       ' (see mfUDK.c for example)
  942.         indType(2).i = MFCOMP_INT     ' An integer key...
  943.         
  944.         If mfCreateDB(file, recsize, 3, indSize(0), indType(0)) < 0 Then
  945.             MsgBox "Error creating card database"
  946.         End If
  947.  
  948.         '**************************************
  949.         ' CREATE REFERENCE DATABASE
  950.  
  951.         file = file + "r"
  952.         ' Calculate the size of an individual records 'data'
  953.         recsize = 25    ' size of the data portion of the record
  954.     
  955.         ' Fill arrays with index parameters
  956.         ' Note: we have 1 index for this database
  957.         ReDim indSize(0 To 0) As tintArray
  958.         ReDim indType(0 To 0) As tintArray
  959.         indSize(0).i = 4  ' length of 2 integer keys...
  960.     
  961.             ' This tells mf the TYPE of the index
  962.         indType(0).i = MFCOMP_INT  ' Integer key
  963.  
  964.         If mfCreateDB(file, recsize, 1, indSize(0), indType(0)) > -1 Then
  965.             ' Let's put some sample data into the REF database
  966.             LoadSampleData file
  967.             
  968.             MsgBox "Databases Created Successfully"
  969.         Else
  970.             MsgBox "Error creating reference database"
  971.         End If
  972.         screen.MousePointer = PNORMAL
  973.  
  974.     End If
  975.  
  976. End Sub
  977.  
  978. ' Demostrates opening a couple of databases
  979. Sub m_Open_Click ()
  980.     Dim vRecSize%, vNumIndex%, vNumRecs&, vLiveRecs&
  981.     Dim file$
  982.     
  983.     file = InputBox$("Enter File Name", "Open CardFile", CARDFILE)
  984.     If Len(file) > 0 Then
  985.         ' Call the open routine with the TASKhndl we recieved
  986.         ' when the application started...
  987.         ' PersonDBHndl will be > -1 if it can open a file...
  988.         PersonDBHndl = mfOpen(file, TaskHndl)
  989.         refDBHndl = mfOpen(file + "r", TaskHndl)
  990.  
  991.         If PersonDBHndl > -1 Then
  992.             curFile = file
  993.  
  994.             junk = mfInfoDB(vRecSize, vNumIndex, vNumRecs, vLiveRecs, TaskHndl, PersonDBHndl)
  995.             PersonTotRecs = vNumRecs
  996.             m_Open.Enabled = False
  997.             m_Close.Enabled = True
  998.             gBox.Enabled = True
  999.             PersonCurRec = mfTop(TaskHndl, PersonDBHndl, PersonCurIndex)
  1000.  
  1001.             ' Load the 'references' combo box
  1002.             load_refs Combo1
  1003.  
  1004.  
  1005.  
  1006.  
  1007.             Command1_Click -1   ' Force disply of top record...
  1008.  
  1009.                
  1010.         Else
  1011.             MsgBox "Error on open: " + Str$(PersonDBHndl)
  1012.         End If
  1013.     End If
  1014.  
  1015. End Sub
  1016.  
  1017. Sub m_Quit_Click ()
  1018.     Unload bCardREf
  1019.     Unload bcard
  1020.  
  1021. End Sub
  1022.  
  1023. Sub m_RplXRandom_Click ()
  1024. ' Tests changing the key for X # of random cards to the database.
  1025. ' This is mostly for data-verifaction/system stress test
  1026. ' NOTE: Don't use this code as a SAMPLE!  IT won't work in the real world.
  1027.  
  1028.     If PersonDBHndl = -1 Then
  1029.         MsgBox "Open a database before trying this..."
  1030.         Exit Sub
  1031.     End If
  1032.  
  1033.  
  1034.     Dim jump&, n&
  1035.     Dim c As tCard
  1036.  
  1037.     jump = Val(InputBox$("# of records to replace?", "Add"))
  1038.  
  1039.     c.data.street = "<Test Data>"
  1040.     c.data.city = "<Test Data>"
  1041.     c.data.state = "<>"
  1042.     c.data.zip = "<Test>"
  1043.     c.data.voice = "<Test>"
  1044.     c.data.fax = "<Test>"
  1045.     Randomize
  1046.  
  1047.     screen.MousePointer = 11    ' Hourglass
  1048.  
  1049.     For n = 1 To jump
  1050.  
  1051.         c.Person.fname = Format$(Rnd)
  1052.         c.Person.lname = Format$(Rnd)
  1053.         c.company.cName = Format$(Rnd)
  1054.         c.ref.ref = Rnd * 32000
  1055.  
  1056.         junkl = mfWrite(n + PersonCurRec, c, TaskHndl, PersonDBHndl, MFRW_ALL)
  1057.  
  1058.         If junkl < 0 Then
  1059.             MsgBox "Error on replace:" + Format$(junkl)
  1060.         End If
  1061.         If Int(n / 10) = n / 10 Then
  1062.             cardnum.Caption = "Processed: " + Format$(n)
  1063.             cardnum.Refresh
  1064.         End If
  1065.  
  1066.  
  1067.     Next n
  1068.  
  1069.     screen.MousePointer = 0    ' Default
  1070.     'PersonCurRec = PersonTotRecs
  1071.     cardnum.Caption = CARDFILE + " " + Format$(PersonCurRec) + "/" + Format$(PersonTotRecs)
  1072.  
  1073. End Sub
  1074.  
  1075. Sub mAbout_Click ()
  1076.     MsgBox "Business Cards  -- This application is freeware.  All source code may be used for any purpose you see fit.  However, the mf.BAS file is copyright 1993 by Carl Brown"
  1077. End Sub
  1078.  
  1079. Sub mBottom_Click ()
  1080.     If PersonDBHndl = -1 Then
  1081.         MsgBox "Open a database before trying this..."
  1082.         Exit Sub
  1083.     End If
  1084.     
  1085.     PersonCurRec = mfBottom(TaskHndl, PersonDBHndl, PersonCurIndex)
  1086.     ' force refresh
  1087.     Command1_Click 3
  1088. End Sub
  1089.  
  1090. Sub mDelete_Click ()
  1091.     If PersonDBHndl = -1 Then
  1092.         MsgBox "Open a database before trying this..."
  1093.         Exit Sub
  1094.     End If
  1095.     If PersonCurRec < 1 Then
  1096.         MsgBox "Move to a record before selecting this option..."
  1097.         Exit Sub
  1098.     End If
  1099.  
  1100.     ' Delete selected record
  1101.     junki = mfDelete(PersonCurRec, TaskHndl, PersonDBHndl)
  1102.     PersonCurRec = mfTop(TaskHndl, PersonDBHndl, PersonCurIndex)
  1103.     Command1_Click 2    ' update display
  1104. End Sub
  1105.  
  1106. Sub mEditRefTbl_Click ()
  1107.     bCardREf.Show
  1108. End Sub
  1109.  
  1110. Sub mLockRecord_Click ()
  1111.     
  1112.     ' In a real world app, you would probably 'enable'
  1113.     ' the edit controls so the user could change
  1114.     ' the record without worrying about someone
  1115.     ' overwriting their changes.
  1116.     If mfLock(PersonCurRec, TaskHndl, PersonDBHndl) = 0 Then
  1117.         MsgBox "Record Locked!"
  1118.         If mfUnLock(PersonCurRec, TaskHndl, PersonDBHndl) <> 0 Then
  1119.             MsgBox "Unable to unlock record!"
  1120.         End If
  1121.     Else
  1122.         MsgBox "Record already locked by another user!"
  1123.     End If
  1124.  
  1125.     
  1126. End Sub
  1127.  
  1128. ' This demonstrates the difference in speed between the
  1129. ' severe-performance functions in mf and the 'standard' performance
  1130. ' functions in mf (and other databases...)
  1131. ' NOTE:  This is JUST meant to give you a general idea...
  1132. Sub mNormalLoad_Click ()
  1133.     If PersonDBHndl = -1 Then
  1134.         MsgBox "Open a database before trying this..."
  1135.         Exit Sub
  1136.     End If
  1137.     Dim hits&, MAX_HITS&, startTime As Variant, n%, startRec&, rCode%, skStr$
  1138.  
  1139.     MAX_HITS = 1000
  1140.     screen.MousePointer = PHOURGLASS
  1141.     startTime = Time
  1142.     ' NOTE:
  1143.     ' We MUST have a 'seek' string padded to AT LEAST the maximum length of
  1144.     ' the index we are about to seek into.  If we don't, MF MAY GPF on us
  1145.     ' because it will be trying to look at memory that could straddle a segment
  1146.     ' boundary.  Space(100) forces plenty of extra padding at the end of the seek string
  1147.     skStr = "0" + Space$(100)
  1148.     startRec = mfSeekS("0", rCode, TaskHndl, PersonDBHndl, 0)
  1149.     If startRec > 0 Then
  1150.         For n = 0 To MAX_HITS
  1151.             ' First off, in order to get a 'partial-key', we would have to 'read' each record to see if it matched
  1152.             ' but, the point of this demo is to show the difference in 'skips' vs. readlists...
  1153.             ' So, these two are not equal.  The readlist is actually even FASTER than this
  1154.             ' because readlist returns the actual 'matching' list...
  1155.             startRec = mfSkip(startRec, 1, TaskHndl, PersonDBHndl, 0)
  1156.             ' make sure we don't hit EOF
  1157.             If startRec < 1 Then
  1158.                 Exit For
  1159.             End If
  1160.     
  1161.         Next n
  1162.     Else
  1163.         MsgBox "Unable to start processing because nothing 'matched' the starting position..."
  1164.     End If
  1165.     
  1166.     MsgBox "Elapsed time: " + Format$(Time - startTime) + "    # of (potential) records read: " + Format$(n)
  1167.     screen.MousePointer = PNORMAL
  1168.  
  1169. End Sub
  1170.  
  1171. ' Demonstration of reindexing
  1172. Sub mReIndex_Click ()
  1173.  
  1174.     ' Make a 'form' that will supply screen updates
  1175.     ' The form actually contains the code to perform
  1176.     ' the reindexing  (see the Form_Load stuff...)
  1177.     junki = PersonDBHndl
  1178.  
  1179.     ' Since the form unloads in it's LOAD procedure,
  1180.     ' we need to trap the error...
  1181.     On Error Resume Next
  1182.     IndexForm.Show asmodal
  1183.     On Error GoTo 0
  1184.     If junki < 0 Then
  1185.         MsgBox "Reindexing failed!  Restart BCards..."
  1186.     End If
  1187.  
  1188.     PersonDBHndl = junki
  1189.     
  1190.     
  1191.  
  1192. End Sub
  1193.  
  1194. ' Demonstrates using a 'severe-performance' function
  1195. ' Use the 'Add X random records' (menu option)
  1196. ' to add a bunch of records that will be retrieved by
  1197. ' this function...
  1198. Sub mSevereLoad_Click ()
  1199.     
  1200.     If PersonDBHndl = -1 Then
  1201.         MsgBox "Open a database before trying this..."
  1202.         Exit Sub
  1203.     End If
  1204.     Dim hits&, MAX_HITS&, startTime As Variant, TopRecord&
  1205.  
  1206.     MAX_HITS = 1000
  1207.     ReDim hitList(0 To MAX_HITS) As tLongArray
  1208.     ' This example reads UP TO 1000 records (in sequential order) that start with
  1209.     ' the character "0".  The THIRD parm (a '1') tells the read API call to only
  1210.     ' process the FIRST character in the index field.
  1211.     ' Since we are seeking on a STRING index, we must use the readListS api call...
  1212.     ' NOTE:  The reason we use the "0" as the example is:  If you use the random
  1213.     ' ADD functions (under TEST) alot of "0.xxxxxxxx" names get created...
  1214.     screen.MousePointer = PHOURGLASS    ' This is SO fast, you may not need this...<grin>
  1215.     startTime = Time
  1216.     hits = mfReadListS(0, "0", 1, hitList(0), MAX_HITS, TaskHndl, PersonDBHndl, 0)
  1217.     screen.MousePointer = PNORMAL
  1218.     MsgBox "Elapsed time: " + Format$(Time - startTime) + "    " + "# of records read: " + Format$(hits)
  1219.     
  1220.     ' Demos a 'continuation set' read.  e.g. lets say there are too many hits to
  1221.     ' load in RAM.  You would have to continue the process using a second read...
  1222.     ' This is here just to show 'HOW' it would be done.  This wont actually work unless you
  1223.     ' have over 1000 hits to retrieve.  If you would like to see it work, make sure you put
  1224.     ' over 1000 records in your database (or cut back on the 'MAX_HITS' value...)
  1225.  
  1226.     'hits = mfReadListS(hitList(MAX_HITS), "0", 1, hitList(0), MAX_HITS, TaskHndl, personDBHndl, 0)
  1227.  
  1228.  
  1229.     ' Demos a 'list' of sequential records.  If you just want the first '1000' records, and
  1230.     ' don't care about a particular 'key', use this.
  1231.     'ReDim hitList(0 To MAX_HITS) As tLongArray
  1232.     'TopRecord = mfTop(TaskHndl, personDBHndl, 0)
  1233.     'hits = mfReadListNull(TopRecord, 0&, -1, hitList(0), MAX_HITS, TaskHndl, personDBHndl, 0)
  1234.  
  1235. End Sub
  1236.  
  1237. ' Demos using the readlist COUNT option
  1238. ' See the mSevereLoad for more comments
  1239. Sub mSPCount_Click ()
  1240.  
  1241.     If PersonDBHndl = -1 Then
  1242.         MsgBox "Open a database before trying this..."
  1243.         Exit Sub
  1244.     End If
  1245.     Dim hits&, startTime As Variant
  1246.  
  1247.     
  1248.     ReDim hitList(0 To 0) As tLongArray
  1249.     screen.MousePointer = PHOURGLASS    ' This is SO fast, you may not need this...<grin>
  1250.     startTime = Time
  1251.     hits = mfReadListS(0, "0", 1, hitList(0), MF_SP_COUNT, TaskHndl, PersonDBHndl, 0)
  1252.     screen.MousePointer = PNORMAL
  1253.     MsgBox "Elapsed time: " + Format$(Time - startTime) + "    " + "# of records matching filter: " + Format$(hits)
  1254.     
  1255.  
  1256. End Sub
  1257.  
  1258. Sub mTop_Click ()
  1259.     If PersonDBHndl = -1 Then
  1260.         MsgBox "Open a database before trying this..."
  1261.         Exit Sub
  1262.     End If
  1263.     
  1264.     PersonCurRec = mfTop(TaskHndl, PersonDBHndl, PersonCurIndex)
  1265.     ' force refresh
  1266.     Command1_Click 3
  1267.  
  1268. End Sub
  1269.  
  1270. Sub Option1_Click (Index As Integer)
  1271.     PersonCurIndex = Index
  1272. End Sub
  1273.  
  1274. Sub Text1_Change (Index As Integer)
  1275.     Command4.Enabled = True
  1276.     command3.Enabled = True
  1277. End Sub
  1278.  
  1279. ' Displays database information
  1280. Sub UpdateStats ()
  1281.     Dim vRecSize%, vNumIndex%, vNumRecs&, vLiveRecs&
  1282.     junk = mfInfoDB(vRecSize, vNumIndex, vNumRecs, vLiveRecs, TaskHndl, PersonDBHndl)
  1283.  
  1284.     cardnum.Caption = CARDFILE + " " + Format$(PersonCurRec) + "/" + Format$(PersonTotRecs)
  1285.     LiveNum.Caption = "Live Records:" + Format$(vLiveRecs)
  1286.  
  1287. End Sub
  1288.  
  1289.